﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Agr.CQRS.Domain;
using Agr.Questionnaire.Core.Domain.Qnnaire.Commands;
using Agr.Questionnaire.Core.Domain.Qnnaire.Events;

namespace Agr.Questionnaire.Core.Domain.Qnnaire
{
    /// <summary>
    /// Represents a set of question plus information about how the question can be answered. For example, it contains
    /// a TextQuestion that can be presented to a user, plus a MultipleOptionChoiceAnswerTemplate with a few possible answers.
    /// </summary>
    public class AnswerableQuestion : Entity
    {
        internal Question Question {get;set;}
        internal AnswerTemplate Answer { get; set; }
        internal int SequenceNumber { get; set; }

        public void UseTextQuestion(string questionText)
        {
            Question = new TextQuestion { Text = questionText };
        }

        public void UseTextAnswerTemplate()
        {
            HandleNewEvent(new TextAnswerTemplateSetOnQuestionEvent());
        }
        private void handle(TextAnswerTemplateSetOnQuestionEvent ev)
        {
            Answer = new TextAnswerTemplate();
        }
    }
}
